package 服务器搭建过程;
import java.util.HashSet;
import java.util.Set;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;
/**
 * @author: yehw
 * @date: 2020/8/7 00:25
 * @description: jedis集群demo
 */
public class JedisClusterDemo {
    public static void main(String[] args) {
        JedisPoolConfig config = new JedisPoolConfig();
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();
        jedisClusterNode.add(new HostAndPort("172.16.38.132", 7001));
        jedisClusterNode.add(new HostAndPort("172.16.38.132", 7002));
        jedisClusterNode.add(new HostAndPort("172.16.38.132", 7003));
        jedisClusterNode.add(new HostAndPort("172.16.38.132", 7004));
        jedisClusterNode.add(new HostAndPort("172.16.38.132", 7005));
        jedisClusterNode.add(new HostAndPort("172.16.38.132", 7006));
        JedisCluster jcd = new JedisCluster(jedisClusterNode);
        jcd.set("我想吐槽", "作业好难");
        String value = jcd.get("我想吐槽");
        System.out.println("结果是："+value);
    }

}
